package text111;

public class Solution15 {
	 public boolean isSymmetric(TreeNode root) {
/*		 if (root==null||(root.left==null&&root.right==null)) {
		        // System.out.println("jin1ai");
						return true;
					}
		            if((root.left!=null&&root.right!=null)&&(root.left.val==root.right.val)){
		               if(root.left!=null&&root.right!=null) {
						return equals(root.left, root.right);
					}else{
		                return false;
		            }
		            }else{
		                return false;
		           
		            }
			    }
			 public boolean equals(TreeNode left,TreeNode right) {
				 if (left.left==null||right.right==null||left.left.val!=right.right.val) {
		              System.out.println("jin1");
					return false;
				}
				 if (left.right==null||right.left==null||left.right.val!=right.left.val) {
		             System.out.println("jin2");
					return false;
				}
				 if (left.left.val==right.right.val&&left.right.val==right.left.val) {
		             System.out.println("jin3");
					return true;
				}else {
					return false;
				}
		    }*/

		     return root == null ? true : recur(root.left, root.right);
		    }
		    boolean recur(TreeNode L, TreeNode R) {
		        if(L == null && R == null) return true;
		        if(L == null || R == null || L.val != R.val) return false;
		        return recur(L.left, R.right) && recur(L.right, R.left);
		    }

}
